package com.atguigu.spring.ioc.service;

import com.atguigu.spring.ioc.bean.Person;
import com.atguigu.spring.ioc.dao.UserDao;
import jakarta.annotation.Resource;
import lombok.ToString;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;

@ToString
@Service
public class UserService {

//    @Qualifier("what'sup")// 精确指定哪个对象,可以无视@Primary的指定
    @Autowired // @Autowired(required=false)可以允许对象为空,找不到也不报错
    Person person;

    // @Resource 和 @Autowired的区别
    // @Resource是java规范,所有java容器都支持. @Autowired是Spring容器的接口
    @Resource
    UserDao userDao;
}
